package com.knxhd.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * Author: tianluhua tianlh@qdcares.cn
 * Date: 2025-07-12 15:28:51
 * Description: 请求结果
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class HttpResult<T> {

  private int code;

  private String message;

  private T data;

  public static <T> HttpResult<T> success(T data) {
    return new HttpResult<>(200, "success", data);
  }

  public static <T> HttpResult<T> error(int code, String message) {
    return new HttpResult<>(code, message, null);
  }
}
